package com.example;

import com.example.entity.User;
import com.example.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        UserService userService = context.getBean("userService", UserService.class);
        User user = userService.getUserById(1L);
        System.out.println(user);
        ((ClassPathXmlApplicationContext) context).close();
    }
}